package cn.com.bluemoon.daps.model.utils.factory.impl.table;

import cn.com.bluemoon.daps.common.enums.DatabaseType;
import cn.com.bluemoon.daps.model.dto.DapDataModelTableDto;
import cn.com.bluemoon.daps.model.utils.factory.TableScriptFactory;
import cn.com.bluemoon.daps.model.utils.factory.impl.field.HiveFieldScript;
import cn.com.bluemoon.daps.model.utils.factory.impl.field.MysqlFieldScript;
import cn.com.bluemoon.daps.model.utils.factory.impl.field.PostgreFieldScript;
import cn.com.bluemoon.daps.model.utils.factory.impl.key.MysqlKeyScript;
import cn.com.bluemoon.daps.model.utils.factory.impl.key.PostgreKeyScript;
import cn.com.bluemoon.daps.model.utils.factory.impl.partition.HivePartitionScript;
import com.alibaba.druid.DbType;

import java.util.List;
import java.util.Map;

/**
 * @author karry
 * @Data 2021/9/8
 * @Time:13:47
 */
public abstract class AbsTableScript implements TableScriptFactory {

    public HiveFieldScript hiveFieldScript;

    public HivePartitionScript hivePartitionScript;

    public MysqlFieldScript mysqlFieldScript;

    public MysqlKeyScript mysqlKeyScript;

    public PostgreFieldScript postgreFieldScript;

    public PostgreKeyScript postgreKeyScript;

    public AbsTableScript (DbType type){
        if(type.equals(DbType.hive)){
            this.hiveFieldScript = new HiveFieldScript();
            this.hivePartitionScript = new HivePartitionScript();
        }else if(type.equals(DbType.mysql)){
            this.mysqlFieldScript = new MysqlFieldScript();
            this.mysqlKeyScript = new MysqlKeyScript();
        }else {
            this.postgreFieldScript = new PostgreFieldScript();
            this.postgreKeyScript = new PostgreKeyScript();
        }
    }
}
